package com.test.web;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.test.model.EbProduct;
import com.test.service.EbProductCategoryService;
import com.test.service.EbProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import java.util.List;


@Controller
@RequestMapping("/product_category")
public class EbProductCategoryController{
    @Autowired
    private EbProductCategoryService ebProductCategoryService;
    @RequestMapping("/detail")
    public String detail(int epcId, Model model,
                                  @RequestParam(defaultValue ="1") int psize,
                                  @RequestParam(defaultValue ="8") int pageSize){
        Page<EbProduct> productPage = ebProductCategoryService.findProductByCate(psize,pageSize,epcId);

        //2.绑定
        model.addAttribute("productPage",productPage);
        //3.返回view
        return "product-list";
    }

}